<?php
define('YAC_VERSION', '2.3.1', true);
define('YAC_MAX_KEY_LEN', 48, true);
define('YAC_MAX_VALUE_RAW_LEN', '64M', true);
define('YAC_MAX_VALUE_COMPRESSED_LEN', '1M', true);
/**
 * @since 2.2.0
 */
define('YAC_SERIALIZER_PHP', 0, true);
define('YAC_SERIALIZER_JSON', 1, true);
define('YAC_SERIALIZER_MSGPACK', 2, true);
define('YAC_SERIALIZER_IGBINARY', 3, true);
define('YAC_SERIALIZER', 0, true);

/**
 * Yac - Yet Another Cache
 * Yac is a shared and lockless memory user data cache for PHP.
 * it can be used to replace APC or local memcached.
 *
 * @since yac 2.3.1
 * @link https://github.com/laruence/yac
 */
class Yac {

    /* properties */
    protected string $_prefix = "";

    /**
     * Constructor of Yac, you can specify a prefix which will used to prepend to any keys when doing set/get/delete
     *
     * @example $yac = new Yac("myproduct_");
     * @param string $prefix
     * @link https://github.com/laruence/yac
     */
    public function __construct(string $prefix = "") {}

    /**
     * Store a value into Yac cache, keys are cache-unique, so storing a second value with the same key will overwrite the original value.
     * Return true on success, return false on error (Like no memory, can not obtain cas write right)
     *
     * @example <code> $yac = new Yac();$yac->set("foo", "bar");$yac->set(array("dummy" => "foo","dummy2" => "foo",)); </code>
     * @param string|array $key
     * @param mixed $value
     * @param int $ttl
     * @return bool|null
     * @link https://github.com/laruence/yac
     */
    public function add(string|array $key, mixed $value, int $ttl = 0):?bool {}

    /**
     * Fetches a stored variable from the cache. If an array is passed then each element is fetched and returned.
     * Return the value on success, return false on error(Like no memory, can not obtain cas write right)
     *
     * @param string|array $key
     * @param mixed|NULL $cas
     * @return bool|null
     * @link https://github.com/laruence/yac
     */
    public function get(string|array $key, mixed &$cas = NULL):?bool {}

    /**
     * Store a value into Yac cache, keys are cache-unique, so storing a second value with the same key will overwrite the original value.
     * Return true on success, return false on error (Like no memory, can not obtain cas write right)
     *
     * @example <code> $yac = new Yac();$yac->set("foo", "bar");$yac->set(array("dummy" => "foo","dummy2" => "foo",)); </code>
     * @param string|array $key
     * @param mixed $value
     * @param int $ttl
     * @return bool|null
     * @link https://github.com/laruence/yac
     */
    public function set(string|array $key, mixed $value, int $ttl = 0):?bool {}

    /**
     * Removes a stored variable from the cache. If delay is specified, then the value will be deleted after $delay seconds.
     *
     * @param string|array $key
     * @param int $delay
     * @return bool|null
     * @link https://github.com/laruence/yac
     */
    public function delete(string|array $key, int $delay = 0):?bool {}

    /**
     * Immediately invalidates all existing items. it doesn't actually free any resources, it only marks all the items as invalid.
     *
     * @return bool
     * @link https://github.com/laruence/yac
     */
    public function flush():bool {}

    /**
     * Get cache info
     *
     * @return array
     * @link https://github.com/laruence/yac
     */
    public function info():array {}

    /**
     * Dump cache info
     *
     * @param int $limit
     * @return array|null
     * @link https://github.com/laruence/yac
     */
    public function dump(int $limit = 0):?array {}
}
